Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: lectures: Add mm lecture #55

Closed
wants to merge 140 commits into from

Conversation

dbaluta
Copy link
Member

@dbaluta dbaluta commented Apr 21, 2018

Initial draft of MM lectures. It doesn't cover virtual memory allocation yet.

Signed-off-by: Daniel Baluta [email protected]

tavip and others added 30 commits July 1, 2017 16:35
The Linux kernel labs documentation is a collection of "labs" for
various device driver topics. For each topic there are two parts: a
walk-through which explain the basic concepts and a hands-on part which
contains a few exercises.

This commit also adds the labs infrastructure which allows us to build
and test kernel modules in a qemu environment.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add the documentation and templates for the kernel modules lab which
focuses on: creating simple modules; describing the process of kernel
module compilation; presenting how a module can be used with a kernel;
simple kernel debugging methods

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add the documentation and templates for the kernel modules lab which
focuses on: familiarizing with the basic Linux kernel API, describing
memory allocation and locking mechanism.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add documentation and templates for the device drivers labs which
focuses on: understanding the concepts behind character device drivers;
understading the various operations that can be performed on character
device drivers; working with waiting queues.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add documentation and templates for the I/O access and interrupts lab
which focuses on: communication with pheripheral devices; implementing
interrupt handlers; synchronizing interrupts with process context.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add documentation and templates for the deffered work lab which focuses
on: understanding deffered work; implementation of common tasks that use
deferred work; understanding the peculiarities of synchronization for
deferred work.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add documentation and templates for the memory mapping lab which focuses
on: understanding the address space mapping mechanism; learn about the
most important structures related to memory mapping.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add documentationa and templates for the Linux device module lab which
focuses on understanding the main Linux abstraction that deals with
devices: devices, buses, drivers, subsystems and classes.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
The Linux kernel labs documentation is a collection of "labs" for
various device driver topics. For each topic there are two parts: a
walk-through which explain the basic concepts and a hands-on part which
contains a few exercises.

This commit also adds the labs infrastructure which allows us to build
and test kernel modules in a qemu environment.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add the documentation and templates for the kernel modules lab which
focuses on: creating simple modules; describing the process of kernel
module compilation; presenting how a module can be used with a kernel;
simple kernel debugging methods

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add the documentation and templates for the kernel modules lab which
focuses on: familiarizing with the basic Linux kernel API, describing
memory allocation and locking mechanism.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add documentation and templates for the device drivers labs which
focuses on: understanding the concepts behind character device drivers;
understading the various operations that can be performed on character
device drivers; working with waiting queues.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add documentation and templates for the I/O access and interrupts lab
which focuses on: communication with pheripheral devices; implementing
interrupt handlers; synchronizing interrupts with process context.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add documentation and templates for the deffered work lab which focuses
on: understanding deffered work; implementation of common tasks that use
deferred work; understanding the peculiarities of synchronization for
deferred work.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add documentation and templates for the memory mapping lab which focuses
on: understanding the address space mapping mechanism; learn about the
most important structures related to memory mapping.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Add documentationa and templates for the Linux device module lab which
focuses on understanding the main Linux abstraction that deals with
devices: devices, buses, drivers, subsystems and classes.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Daniel Baluta <[email protected]>
Since we are going to add lectures change the top level directory name
from labs to teaching/labs.

Signed-off-by: Octavian Purdila <[email protected]>
Enable hieroglyph extension if it is installed on the host and add a
slides documentation target.

Signed-off-by: Octavian Purdila <[email protected]>
Signed-off-by: Octavian Purdila <[email protected]>
This is based on the psphinxcontrib.ditaa pip package and we add it
localy since we need some fixes to properly render images in
hieroglpyh slides.

Signed-off-by: Octavian Purdila <[email protected]>
Add reqirements.txt and run pip in the doc target to make sure we have
all required sphinx dependencies.

Signed-off-by: Octavian Purdila <[email protected]>
This is split into two parts: one the is specific to cs.pub.ro and
another one that is generic.

Signed-off-by: Octavian Purdila <[email protected]>
Add docs building and publishing support via Circle CI
The conf.py needs to be at the top of the namespace directory so move
it where it belongs.

And since we now have multiple subdirectories and includes are
relative to current file directory, the common substitution will not
longer work for all files. To fix this, just move the contents of
subst.hrst directly to rst_epilog in conf.py.

Fixes the following errors:

deferred_work.rst:721: ERROR: Undefined substitution referenced: "LXR".
deferred_work.rst:721: ERROR: Unknown target name: "lxr".
interrupts.rst:688: ERROR: Undefined substitution referenced: "LXR".
interrupts.rst:688: ERROR: Unknown target name: "lxr".
kernel_api.rst:739: ERROR: Unexpected indentation.
kernel_api.rst:582: ERROR: Undefined substitution referenced: "LXR".
kernel_api.rst:582: ERROR: Unknown target name: "lxr".
kernel_modules.rst:810: ERROR: Undefined substitution referenced: "LXR".
kernel_modules.rst:939: ERROR: Undefined substitution referenced: "LXR".
kernel_modules.rst:810: ERROR: Unknown target name: "lxr".
kernel_modules.rst:939: ERROR: Unknown target name: "lxr".

Signed-off-by: Octavian Purdila <[email protected]>
Documentation: move teaching/labs/conf.py to teaching/
Introduction lab presents few ways to navigate the kernel source code
(LXR and cscope) and how to perform static and dynamic kernel analysis
using gdb, vmlinux and /proc/kcore.
andanicolae and others added 3 commits April 15, 2018 22:18
Remove reference to deprecated field struct block_device *bi_bdev
from struct bio and add instead struct gendisk *bi_disk field.

Signed-off-by: Anda Nicolae <[email protected]>
@dbaluta dbaluta requested review from razvand and tavip April 21, 2018 12:57
tavip pushed a commit to linux-kernel-labs/linux-kernel-labs.github.io that referenced this pull request Apr 21, 2018
valighita and others added 11 commits April 24, 2018 21:42
…ing-lab-template

labs: lab10: add networking lab template
tools: labs: Update setup for QEMU image and Linux kernel 4.15 for networking lab
  * fix grammar issues
  * use Sphinx syntax when needed to highlight C structures,
    functions, macros etc.
  * parse line > 80

Signed-off-by: Anda Nicolae <[email protected]>
One can use this skeleton to start implementing e100 driver
assignment.

Signed-off-by: Daniel Baluta <[email protected]>
Change network for second interface because nttcp is compiled
with hardcoded listening addresss (172.30.0.1).

TODO: recompile nttcp to support configurable ip address.

Signed-off-by: Daniel Baluta <[email protected]>
tavip pushed a commit to linux-kernel-labs/linux-kernel-labs.github.io that referenced this pull request May 20, 2018
tavip pushed a commit to linux-kernel-labs/linux-kernel-labs.github.io that referenced this pull request May 20, 2018
@razvand razvand added the lectures Kernel lectures and slides label May 20, 2018
@razvand
Copy link

razvand commented Apr 21, 2019

@dbaluta , @tavip , this is a rather old PR. Should we close it?

@dbaluta dbaluta closed this Apr 21, 2019
@dbaluta
Copy link
Member Author

dbaluta commented Apr 21, 2019

No longer applies. Anyhow, keep in mind that pictures from this PR are quite good and can re-use them.

@razvand
Copy link

razvand commented Apr 21, 2019

No longer applies. Anyhow, keep in mind that pictures from this PR are quite good and can re-use them.

This is for @tavip to integrate in the mm lecture.

dbaluta pushed a commit to dbaluta/linux that referenced this pull request Jun 5, 2019
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
linux-kernel-labs#42: FILE: fs/ocfs2/aops.c:2155:
+	unsigned i_blkbits = inode->i_sb->s_blocksize_bits;

ERROR: code indent should use tabs where possible
linux-kernel-labs#53: FILE: fs/ocfs2/aops.c:2166:
+ ^I * "pos" and "end", we need map twice to return different buffer state:$

WARNING: please, no space before tabs
linux-kernel-labs#53: FILE: fs/ocfs2/aops.c:2166:
+ ^I * "pos" and "end", we need map twice to return different buffer state:$

ERROR: code indent should use tabs where possible
linux-kernel-labs#54: FILE: fs/ocfs2/aops.c:2167:
+ ^I * 1. area in file size, not set NEW;$

WARNING: please, no space before tabs
linux-kernel-labs#54: FILE: fs/ocfs2/aops.c:2167:
+ ^I * 1. area in file size, not set NEW;$

ERROR: code indent should use tabs where possible
linux-kernel-labs#55: FILE: fs/ocfs2/aops.c:2168:
+ ^I * 2. area out file size, set  NEW.$

WARNING: please, no space before tabs
linux-kernel-labs#55: FILE: fs/ocfs2/aops.c:2168:
+ ^I * 2. area out file size, set  NEW.$

ERROR: code indent should use tabs where possible
linux-kernel-labs#56: FILE: fs/ocfs2/aops.c:2169:
+ ^I *$

WARNING: please, no space before tabs
linux-kernel-labs#56: FILE: fs/ocfs2/aops.c:2169:
+ ^I *$

ERROR: code indent should use tabs where possible
linux-kernel-labs#57: FILE: fs/ocfs2/aops.c:2170:
+ ^I *^I^I   iblock    endblk$

WARNING: please, no space before tabs
linux-kernel-labs#57: FILE: fs/ocfs2/aops.c:2170:
+ ^I *^I^I   iblock    endblk$

ERROR: code indent should use tabs where possible
linux-kernel-labs#58: FILE: fs/ocfs2/aops.c:2171:
+ ^I * |--------|---------|---------|---------$

WARNING: please, no space before tabs
linux-kernel-labs#58: FILE: fs/ocfs2/aops.c:2171:
+ ^I * |--------|---------|---------|---------$

ERROR: code indent should use tabs where possible
linux-kernel-labs#59: FILE: fs/ocfs2/aops.c:2172:
+ ^I * |<-------area in file------->|$

WARNING: please, no space before tabs
linux-kernel-labs#59: FILE: fs/ocfs2/aops.c:2172:
+ ^I * |<-------area in file------->|$

ERROR: code indent should use tabs where possible
linux-kernel-labs#60: FILE: fs/ocfs2/aops.c:2173:
+ ^I */$

WARNING: please, no space before tabs
linux-kernel-labs#60: FILE: fs/ocfs2/aops.c:2173:
+ ^I */$

total: 8 errors, 9 warnings, 40 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

NOTE: Whitespace errors detected.
      You may wish to use scripts/cleanpatch or scripts/cleanfile

./patches/ocfs2-clear-zero-in-unaligned-direct-io.patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.

Please run checkpatch prior to sending patches

Cc: Jia Guo <[email protected]>
Cc: Yiwen Jiang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Stephen Rothwell <[email protected]>
dbaluta pushed a commit to dbaluta/linux that referenced this pull request May 3, 2022
After rx/tx ring buffer size is changed, kernel panic occurs when
it acts XDP_TX or XDP_REDIRECT.

When tx/rx ring buffer size is changed(ethtool -G), sfc driver
reallocates and reinitializes rx and tx queues and their buffer
(tx_queue->buffer).
But it misses reinitializing xdp queues(efx->xdp_tx_queues).
So, while it is acting XDP_TX or XDP_REDIRECT, it uses the uninitialized
tx_queue->buffer.

A new function efx_set_xdp_channels() is separated from efx_set_channels()
to handle only xdp queues.

Splat looks like:
   BUG: kernel NULL pointer dereference, address: 000000000000002a
   #PF: supervisor write access in kernel mode
   #PF: error_code(0x0002) - not-present page
   PGD 0 P4D 0
   Oops: 0002 [#4] PREEMPT SMP NOPTI
   RIP: 0010:efx_tx_map_chunk+0x54/0x90 [sfc]
   CPU: 2 PID: 0 Comm: swapper/2 Tainted: G      D           5.17.0+ linux-kernel-labs#55 e8beeee8289528f11357029357cf
   Code: 48 8b 8d a8 01 00 00 48 8d 14 52 4c 8d 2c d0 44 89 e0 48 85 c9 74 0e 44 89 e2 4c 89 f6 48 80
   RSP: 0018:ffff92f121e45c60 EFLAGS: 00010297
   RIP: 0010:efx_tx_map_chunk+0x54/0x90 [sfc]
   RAX: 0000000000000040 RBX: ffff92ea506895c0 RCX: ffffffffc0330870
   RDX: 0000000000000001 RSI: 00000001139b10ce RDI: ffff92ea506895c0
   RBP: ffffffffc0358a80 R08: 00000001139b110d R09: 0000000000000000
   R10: 0000000000000001 R11: ffff92ea414c0088 R12: 0000000000000040
   R13: 0000000000000018 R14: 00000001139b10ce R15: ffff92ea506895c0
   FS:  0000000000000000(0000) GS:ffff92f121ec0000(0000) knlGS:0000000000000000
   CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
   Code: 48 8b 8d a8 01 00 00 48 8d 14 52 4c 8d 2c d0 44 89 e0 48 85 c9 74 0e 44 89 e2 4c 89 f6 48 80
   CR2: 000000000000002a CR3: 00000003e6810004 CR4: 00000000007706e0
   RSP: 0018:ffff92f121e85c60 EFLAGS: 00010297
   PKRU: 55555554
   RAX: 0000000000000040 RBX: ffff92ea50689700 RCX: ffffffffc0330870
   RDX: 0000000000000001 RSI: 00000001145a90ce RDI: ffff92ea50689700
   RBP: ffffffffc0358a80 R08: 00000001145a910d R09: 0000000000000000
   R10: 0000000000000001 R11: ffff92ea414c0088 R12: 0000000000000040
   R13: 0000000000000018 R14: 00000001145a90ce R15: ffff92ea50689700
   FS:  0000000000000000(0000) GS:ffff92f121e80000(0000) knlGS:0000000000000000
   CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
   CR2: 000000000000002a CR3: 00000003e6810005 CR4: 00000000007706e0
   PKRU: 55555554
   Call Trace:
    <IRQ>
    efx_xdp_tx_buffers+0x12b/0x3d0 [sfc 84c94b8e32d44d296c17e10a634d3ad454de4ba5]
    __efx_rx_packet+0x5c3/0x930 [sfc 84c94b8e32d44d296c17e10a634d3ad454de4ba5]
    efx_rx_packet+0x28c/0x2e0 [sfc 84c94b8e32d44d296c17e10a634d3ad454de4ba5]
    efx_ef10_ev_process+0x5f8/0xf40 [sfc 84c94b8e32d44d296c17e10a634d3ad454de4ba5]
    ? enqueue_task_fair+0x95/0x550
    efx_poll+0xc4/0x360 [sfc 84c94b8e32d44d296c17e10a634d3ad454de4ba5]

Fixes: 3990a8f ("sfc: allocate channels for XDP tx queues")
Signed-off-by: Taehee Yoo <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lectures Kernel lectures and slides
Projects
None yet
Development

Successfully merging this pull request may close these issues.